package mylibrary.ejb.v2.cmp;

import javax.ejb.CreateException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;

public abstract class CustomerEntityBean implements EntityBean {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private EntityContext ctx;
	public abstract Integer getId();
	public abstract void setId(Integer id);
	
	public abstract String getFirstName();
	public abstract void setFirstName(String firstName);
	
	public void setEntityContext(EntityContext ctx) {
		this.ctx = ctx;
	}
	public void unsetEntityContext() {
		this.ctx = null;
	}
	
	public void ejbActivate() {}
    public void ejbPassivate() {}
    public void ejbLoad() {}
    public void ejbStore() {}
    public void ejbRemove() {}
    
	public Integer ejbCreate(CustomerVO vo) throws CreateException {
		setId(vo.getId());
		setFirstName(vo.getFirstName());
		return null;
	}
    public void ejbPostCreate(CustomerVO vo) {
    }

    public void says(String message) {
    	System.out.println(getFirstName() + " " + message);
    }
	
//	public CustomerVO getCustomer() throws RemoteException {
//
//		CustomerVO customer = new CustomerVO();
//		customer.setId(getId().intValue());
//		customer.setFirstName(getFirstName());
//		return customer;
//	}

}
